
goog.provide('gaillard.main');

goog.require('goog.dom');
goog.require('gaillard.Model');
goog.require('gaillard.HeaderFragment');
goog.require('gaillard.RestaurantListFragment');
goog.require('gaillard.RestaurantFormFragment');
goog.require('gaillard.MapFragment');

gaillard.main = function () {
	
	var model = gaillard.Model.getInstance();
	    
	var header = new gaillard.HeaderFragment(model);
	header.decorate(goog.dom.getElement('header'));
	
	var restaurantList = new gaillard.RestaurantListFragment(model);
	restaurantList.decorate(goog.dom.getElement('restaurant-list'));
	
    var restaurantForm = new gaillard.RestaurantFormFragment(model);    
    
    var map = new gaillard.MapFragment(model);
    map.decorate(goog.dom.getElement('mapcanvas'));
    
	function resize() {
		var height = window.innerHeight - 100;
		goog.dom.getElement('content').style.height = height + "px";
	}
    
	resize();
	goog.events.listen(window, goog.events.EventType.RESIZE, resize);
};